package Demo.demo18;

public class Hero {
    String name;
    int hp;
    int attack;
    int defence;
    String weapon;
    String shuohua;

    public void fight(Monster m){
        System.out.println(this.name + "提着"+weapon+"冲向了"+m.name);

        m.injured(this);

    }
    public void injured(Monster m){
        int lostLife = m.attack - this.defence;
        if(lostLife <= 1){
            lostLife = 1;
        }
        this.hp -= lostLife;
        System.out.println(this.name + "受到"+lostLife+"点伤害~~,"+"并且高呼"+shuohua+ "剩余血量:" + this.hp);
    }
}
